package com.cjz.demo2;
/**
 * lambda表达式之线程创建
 */
public class Test {
    public static void main(String[] args) {

        //传统创建线程
        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("this is thread1");
            }
        }).start();

        //lambda表达式简化形式1 单行语句
        new Thread(() -> System.out.println("this is thread2")).start();

        //lambda表达式简化形式2 多行语句
        new Thread(() -> {
            System.out.println("this is thread31");
            System.out.println("this is thread32");
        }).start();

        //此时lambda表达式:
        Runnable runnable = () -> System.out.println("this is thread 4");
        new Thread(runnable).start();

    }
}
